Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

410
Visualizações
getting error " TypeError: Found non-callable @@iterator " even though the array is inerrable

enter image description hereI'm using one of the online JS editor and it is giving me this below error although when I'm consoling the value of initial it is an array so it should iterate. I' not getting what is wrong with it. Thanks in advance for helping.

 let lists = [[1,4,5],[1,3,4],[2,6]];
 let output=[];
 let initial = lists[0]?lists[0]:[]
 output.push(...initial); //giving error here

 for(let i=1; i<lists.length; i++) {
    curr = output;
    next = lists[i];
    j=0;k=0;
    x=0;
    //console.log(j,next,'next')
    while(j<next.length) {
        
        if(next[j]<=curr[x]){
            output.splice(x,0,next[j]);
            j++;
            x++;
        }else{
          if(curr.length>x){
              //k++;
              x++;
          }else{
            output.push(...next.slice(j))
            break;
          }
            
        }
        
     }
  }
 //console.log(output)
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda